﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControlSach.ascx.cs" Inherits="WebUserControl" %>
<%@ Import Namespace="SachOnlineLibrary.Public" %>

<style type="text/css">
    .auto-style1 {
        width: 100%;
    }

    .auto-style2 {
        width: 481px;
    }
    .auto-style3 {
        text-align: right;
    }
</style>

<div style="width: 100%">
    <table class="auto-style1">
        <tr>
            <td class="auto-style2">
                <asp:Label ID="Label1" runat="server" Text="Loại sách"></asp:Label>
                &nbsp;
                        <asp:DropDownList ID="ddlLoaiSach" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlLoaiSach_SelectedIndexChanged">
                        </asp:DropDownList>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:CheckBox ID="chbHetHang" runat="server" AutoPostBack="True" OnCheckedChanged="chbHetHang_CheckedChanged" Text="Hiển thị sách đã hết hàng" />
            </td>
            <td class="auto-style3">
                <asp:TextBox ID="txtTimKiem" runat="server"></asp:TextBox>
                &nbsp;
                        <asp:Button ID="btnTimKiem" runat="server" Text="Tìm kiếm" OnClick="btnTimKiem_Click" />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:CheckBox ID="cbxHienThi" runat="server" OnCheckedChanged="cbxHienThi_CheckedChanged" Text="Không hiển thị sách đã ngừng bán" Checked="true" AutoPostBack="true" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:GridView ID="gdvSach" runat="server" CellPadding="3" AutoGenerateColumns="False" Width="100%" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" ShowFooter="True" OnRowCommand="gdvSach_RowCommand" AllowPaging="True" PageSize="5" ShowHeaderWhenEmpty="True" OnRowCancelingEdit="gdvSach_RowCancelingEdit" OnRowEditing="gdvSach_RowEditing" OnRowUpdating="gdvSach_RowUpdating" AllowSorting="True" OnPageIndexChanging="gdvSach_PageIndexChanging">
                    <Columns>
                        <asp:TemplateField HeaderText="Hình">
                            <EditItemTemplate>
                                <asp:FileUpload ID="fuSuaHinh" runat="server" FileName='<%# Eval("Hinh") %>' Width="89px" />
                            </EditItemTemplate>
                            <FooterTemplate>
                                <asp:FileUpload ID="fuThemHinh" runat="server" Width="94px" />
                            </FooterTemplate>
                            <ItemTemplate>
                                <asp:Image ID="imgHinh" runat="server" ImageUrl='<%# "Images/"+Eval("Hinh") %>' Height="103px" Width="88px" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Tên sách">

                            <EditItemTemplate>
                                <asp:TextBox ID="txtSuaTenSach"  runat="server" Width="107px" Text='<%# Eval("Tensach") %>' Height="32px" TextMode="MultiLine"></asp:TextBox>
                            </EditItemTemplate>

                            <FooterTemplate>
                                <asp:TextBox ID="txtThemTenSach" runat="server" Width="104px"></asp:TextBox>
                                <br />
                            </FooterTemplate>

                            <ItemTemplate>
                                <asp:Label ID="TextBox1" runat="server" Text='<%# Eval("Tensach") %>'></asp:Label>
                            </ItemTemplate>

                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Loại">
                            <EditItemTemplate>
                                <asp:DropDownList ID="ddlSuaLoai" runat="server" DataSource='<%#(List<Loai>)Session["Loaisach"]%>' DataTextField="TenLoai" DataValueField="MaLoai">
                                </asp:DropDownList>
                            </EditItemTemplate>
                            <FooterTemplate>
                                <asp:DropDownList ID="ddlThemLoai" runat="server" DataSource='<%#(List<Loai>)Session["Loaisach"]%>' DataTextField="TenLoai" DataValueField="MaLoai">
                                </asp:DropDownList>
                            </FooterTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblLoai" runat="server" Text='<%# Eval("Loai.TenLoai") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Giá tiền">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtSuaGiaTien" runat="server" Width="78px" Text='<%# Eval("GiaTien") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <FooterTemplate>
                                <asp:TextBox ID="txtThemGiaTien" runat="server" Width="78px"></asp:TextBox>
                            </FooterTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label4" runat="server" Text='<%# Eval("GiaTien") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Số lượng">
                            <EditItemTemplate>
                                <asp:DropDownList ID="ddlSuaSoLuong" runat="server">
                                    <asp:ListItem>0</asp:ListItem>
                                    <asp:ListItem>1</asp:ListItem>
                                    <asp:ListItem>2</asp:ListItem>
                                    <asp:ListItem>3</asp:ListItem>
                                    <asp:ListItem>4</asp:ListItem>
                                    <asp:ListItem>5</asp:ListItem>
                                    <asp:ListItem>6</asp:ListItem>
                                    <asp:ListItem>7</asp:ListItem>
                                    <asp:ListItem>8</asp:ListItem>
                                    <asp:ListItem>9</asp:ListItem>
                                    <asp:ListItem>10</asp:ListItem>
                                    <asp:ListItem>11</asp:ListItem>
                                    <asp:ListItem>12</asp:ListItem>
                                    <asp:ListItem>13</asp:ListItem>
                                    <asp:ListItem>14</asp:ListItem>
                                    <asp:ListItem>15</asp:ListItem>
                                    <asp:ListItem>16</asp:ListItem>
                                    <asp:ListItem>17</asp:ListItem>
                                    <asp:ListItem>18</asp:ListItem>
                                    <asp:ListItem>19</asp:ListItem>
                                    <asp:ListItem>20</asp:ListItem>
                                </asp:DropDownList>
                            </EditItemTemplate>
                            <FooterTemplate>
                                <asp:DropDownList ID="ddlThemSoLuong" runat="server">
                                    <asp:ListItem>0</asp:ListItem>
                                    <asp:ListItem>1</asp:ListItem>
                                    <asp:ListItem>2</asp:ListItem>
                                    <asp:ListItem>3</asp:ListItem>
                                    <asp:ListItem>4</asp:ListItem>
                                    <asp:ListItem>5</asp:ListItem>
                                    <asp:ListItem>6</asp:ListItem>
                                    <asp:ListItem>7</asp:ListItem>
                                    <asp:ListItem>8</asp:ListItem>
                                    <asp:ListItem>9</asp:ListItem>
                                    <asp:ListItem>10</asp:ListItem>
                                    <asp:ListItem>11</asp:ListItem>
                                    <asp:ListItem>12</asp:ListItem>
                                    <asp:ListItem>13</asp:ListItem>
                                    <asp:ListItem>14</asp:ListItem>
                                    <asp:ListItem>15</asp:ListItem>
                                    <asp:ListItem>16</asp:ListItem>
                                    <asp:ListItem>17</asp:ListItem>
                                    <asp:ListItem>18</asp:ListItem>
                                    <asp:ListItem>19</asp:ListItem>
                                    <asp:ListItem>20</asp:ListItem>
                                </asp:DropDownList>
                            </FooterTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblSoLuong" runat="server" Text='<%# Eval("SoLuong") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Tác giả">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtSuaTacGia" runat="server" Width="100px" Text='<%# Eval("TacGia") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <FooterTemplate>
                                <asp:TextBox ID="txtThemTacGia" runat="server" Width="100px"></asp:TextBox>
                            </FooterTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label6" runat="server" Text='<%# Eval("TacGia") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Nhà xuất bản">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtSuaNhaXuatBan" runat="server" DataSource='<%# Eval("NhaXuatBan")%>'></asp:TextBox>
                            </EditItemTemplate>
                            <FooterTemplate>
                                <asp:TextBox ID="txtThemNhaXuatBan" runat="server" DataSource='<%# Eval("NhaXuatBan")%>'></asp:TextBox>
                            </FooterTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblNhaXuatBan" runat="server" Text='<%# Eval("NhaXuatBan") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Mô tả">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtSuaMoTa" runat="server" Width="463px" Text='<%# Eval("MoTa") %>' TextMode="MultiLine"></asp:TextBox>
                            </EditItemTemplate>
                            <FooterTemplate>
                                <asp:TextBox ID="txtThemMoTa" runat="server" Width="463px" TextMode="MultiLine"></asp:TextBox>
                            </FooterTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label7" runat="server" Text='<%# Eval("MoTa") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Trạng thái">
                            <EditItemTemplate>
                                <asp:CheckBox ID="cbxSuaTrangThai" runat="server" />
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:CheckBox ID="cbxTrangThai" runat="server" Checked='<%# Eval("TrangThai") %>' Enabled="false" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <EditItemTemplate>
                                <asp:Button ID="btnOK" runat="server" CommandName="Update" Text="OK" Width="52px" CommandArgument='<%# Eval("MaSach") %>'  />
                                &nbsp;
                                <asp:Button ID="btnCancel" runat="server" CommandName="Cancel" Text="Cancel" Width="52px" />
                            </EditItemTemplate>
                            <FooterTemplate>
                                <asp:Button ID="btnThemSach" runat="server" CommandName="ThemSach" Text="Thêm" Width="52px" />
                            </FooterTemplate>
                            <ItemTemplate>
                                <asp:Button ID="btnSuaSach" runat="server" CommandName="Edit" Text="Sửa" Width="52px"/>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataTemplate>
                        Không có sách nào được tìm thấy

                    </EmptyDataTemplate>
                    <FooterStyle BackColor="White" ForeColor="#000066" />
                    <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                    <RowStyle ForeColor="#000066" />
                    <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                    <SortedAscendingCellStyle BackColor="#F1F1F1" />
                    <SortedAscendingHeaderStyle BackColor="#007DBB" />
                    <SortedDescendingCellStyle BackColor="#CAC9C9" />
                    <SortedDescendingHeaderStyle BackColor="#00547E" />
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td colspan="2">

                <asp:Label ID="lblThongBao" runat="server" ForeColor="#3366FF" Text="Label" Visible="False" Font-Size="Large"></asp:Label>

            </td>
        </tr>
    </table>
</div>
